package design.pattern.singleton.register;

import design.pattern.ConcurrentExecutor;

/**
 * @description:
 * @author: liuzhangcheng
 **/
public class ContainerSingletonTest {
    public static void main(String[] args) {
        try {
            // 是非线程安全的
            long start = System.currentTimeMillis();
            ConcurrentExecutor.execute(() -> {
                Object obj = ContainerSingleton.getInstance("java.lang.String");
                System.out.println(System.currentTimeMillis() + ": " + obj);
            }, 10, 6);
            long end = System.currentTimeMillis();
            System.out.println("总耗时：" + (end - start) + " ms.");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
